﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AnesSystem
{
    public class PermissionsManager:BaseManager<PermissionsManager>
    {

        public bool CanEditTables
        {
            get
            {
                if (CkeckParticipates(DataManager.Instance.Login.WorkID) ||
                    (DataManager.Instance.Login.ZhiCheng != null &&
                    DataManager.Instance.Login.ZhiCheng.Contains("主任")))
                {
                    return true;
                }
                else
                {
                    if (Constants.OR_STATUS_FLAG_IN_ROOM.Equals(DataManager.Instance.CurrentPatientLink.Application.Detailstatus)) 
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
        }

        public bool CkeckParticipates(string id)
        {
            List<string> strs = new List<string> {
                    DataManager.Instance.CurrentPatientLink.AnesthesiaRecord.Zmys,
                    DataManager.Instance.CurrentPatientLink.AnesthesiaRecord.Fmys1,
                    DataManager.Instance.CurrentPatientLink.AnesthesiaRecord.Fmys2,
                    DataManager.Instance.CurrentPatientLink.AnesthesiaRecord.Fmys3,
                    DataManager.Instance.CurrentPatientLink.Pacu.Mzys1,
                    DataManager.Instance.CurrentPatientLink.Pacu.Mzys2,
                    DataManager.Instance.CurrentPatientLink.Pacu.Hs,
                    "admin" };
            if (strs.Contains(id))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
